<?php
//require_once 'ObserverInterface.php';
//require_once '../Display/DisplayInterface.php';

abstract class Observer implements ObserverInterface{
    private $displayTarget;
    private $name;
    public function __construct($name, DisplayInterface $display)
    {
        $this->name = $name;
        $this->setDisplay($display);
    }

    public function setDisplay(DisplayInterface $display)
    {
        $this->displayTarget = $display;
    }


    public abstract function update(SubjectInterface $subject);
    public abstract function getDisplay();

    public function display()
    {
        echo $this->name."--气象更新--";
        echo "<br>";
        echo $this->displayTarget->display($this->getDisplay());
        echo "<br>";
    }
}